package cn.tt.moudles.sys.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * @Description
 *  测试类：只有三个字段：id、age、name

CREATE TABLE `demo` (
	`id` bigint(20) NOT NULL AUTO_INCREMENT,
	`age` int(11) NOT NULL,
	`name` varchar(255) NOT NULL,
	PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;

 * @Date 2017/7/29 16:49
 * @Since v1.7
 * @Autor Nick
 */
@Data
@TableName("demo")
@EqualsAndHashCode(callSuper = false)
public class Demo extends Model<Demo> {

	@TableId("id")
	private Integer id;

	private String name;

	private Integer age;

	public Demo() {}

	public Demo(String name, Integer age) {
		this.name = name;
		this.age = age;
	}

	public Demo(Integer id, String name, Integer age) {
		this.id = id;
		this.name = name;
		this.age = age;
	}

	@Override
	public String toString() {
		return "User [id=" + this.getId() + ", name=" + this.getName() + ", age=" + this.getAge() + "]";
	}

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

}
